/**
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved. <br/>
 */
package com.icinfo.cloud.provider.punish.ucase.investigateevidence.transfer.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.framework.tools.utils.StringUtils;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * 描述: 案件移交材料证据表 case_transfer_record_file 对应的实体类.<br>
 * WARNING：不是表中字段的属性必须加@Transient注解
 *
 * @author framework generator
 * @date 2022年12月09日
 */

@Data
@Table(name = "upcase.case_transfer_record_file")
public class CaseTransferRecordFile implements Serializable {
    /**
     * id
     */
    @Id
    @Column(name = "id")
    private String id;

    /**
     * 案件id
     */
    @Column(name = "case_id")
    private String caseId;

    /**
     * 材料类型：1-证据类，2-文书类
     */
    @Column(name = "evidence_cata")
    private String evidenceCata;

    /**
     * 文件名称
     */
    @Column(name = "file_name")
    private String fileName;

    /**
     * 文件类型
     */
    @Column(name = "file_type")
    private String fileType;

    /**
     * 文件后缀
     */
    @Column(name = "file_suffix")
    private String fileSuffix;

    /**
     * 文件链接
     */
    @Column(name = "file_url")
    private String fileUrl;

    /**
     * 创建时间
     */
    @Column(name = "created")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date created;

    /**
     * 修改时间
     */
    @Column(name = "updated")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updated;

    /**
     * 移交类型：1-协查协办，2-案件移交，3-案源移交
     */
    @Column(name = "transfer_type")
    private String transferType;

    /**
     * 案源id
     */
    @Column(name = "case_source_id")
    private String caseSourceId;

    /**
     * 是否删除：0-否，1-是
     */
    @Column(name = "deleted")
    private String deleted;

    /**
     * 协同指挥回传的唯一id
     */
    @Column(name = "send_uid")
    private String sendUid;

    /**
     * 协同指挥案件移交材料类型：A_PUNISH_01-证据类，B_PUNISH_01-文书类
     */
    @Transient
    private String evidenceCode;

    public String getEvidenceCode() {
        if (StringUtils.isNotBlank(evidenceCata)) {
            //证据类
            if (Constant.STRING_1.equals(evidenceCata)) {
                return Constant.TRANSFER_FILE_SUB_TYPE_A;
            }
            return Constant.TRANSFER_FILE_SUB_TYPE_B;
        }
        return evidenceCode;
    }

    private static final long serialVersionUID = 1L;

}